<template>
  <div class="y-split" ref="$split">
    <div ref="left" class="y-split-left">
      <slot name="left"></slot>
    </div>
    <div ref="right" class="y-split-right">
      <slot name="right"></slot>
    </div>
  </div>
</template>

<script>
import Split from "./split";
export default {
  name: "y-split",
  props: {
    sizes: Array,
  },
  mounted() {
    var _this = this
    var { sizes } = this;
    var { left, right } = this.$refs;
    Split([left, right], {
      sizes: sizes,
      gutterSize: 5,
      cursor: "col-resize",
    });
    var sibingHeight = 0
    // this.$refs.$split.parentElement.children.forEach(c=>{
    //   if(c != _this.$refs.$split){
    //     sibingHeight += c.clientHeight
    //   }
    // });
    // _this.$refs.$split.style.height = `calc(100% - ${sibingHeight}px)`
  },
};
</script>

<style lang="scss" scoped>
.y-split {
  display: flex;
  .y-split-left {
  }
  .y-split-right {
  }
}

.gutter.gutter-horizontal {
  cursor: ew-resize;
  &:active {
    background-color: #22d3a7;
  }
  &:hover {
    background-color: #22d3a7;
  }
}
</style>